package com.dj.mingkong.portal.biz.repository.database.system;

import com.dj.mingkong.common.infrastructure.base.dto.query.QueryVo;
import com.dj.mingkong.common.infrastructure.base.repository.BaseDatabaseRepository;
import com.dj.mingkong.common.infrastructure.eo.database.system.UserVisitEo;
import com.dj.mingkong.portal.biz.repository.database.system.mapper.UserVisitMapper;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * 用户访客repository
 *
 * @author zenglonghui
 * @date: 2022/8/21 12:02
 */
@Repository
public class UserVisitRepository extends BaseDatabaseRepository<UserVisitMapper, UserVisitEo, QueryVo> {
    public Optional<UserVisitEo> oneOptByUserIdAndVisitUserId(Long userId, Long visitUserId) {
        return lambdaQuery().eq(UserVisitEo::getUserId, userId)
                .eq(UserVisitEo::getVisitUserId, visitUserId)
                .oneOpt();
    }
}
